<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "{{%cart}}".
 *
 * @property integer $id
 * @property integer $store_id
 * @property integer $user_id
 * @property integer $goods_id
 * @property integer $num
 * @property integer $addtime
 * @property integer $is_delete
 * @property string $attr
 */
class GoodsLevelPrice extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%goods_level_price}}';
    }

    /**
     * @inheritdoc
     */
    // public function rules()
    // {
    //     return [
    //         [['store_id', 'user_id', 'goods_id', 'attr'], 'required'],
    //         [['store_id', 'user_id', 'goods_id', 'num', 'addtime', 'is_delete'], 'integer'],
    //         [['attr'], 'string'],
    //     ];
    // }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'store_id' => 'Store ID',
            'level_id' => '等级 ID',
            'level_price' => '等级 售价',
            'level_cost_price' => '等级 成本价',
            'level_original_price' => '等级 原价',
            'goods_id' => '商品 ID',
        ];
    }

    /**
     * 商品表 一对一关系
     */
    public function getGoods()
    {
        return $this->hasOne(Goods::className(),['id'=>'goods_id']);
    }
}
